﻿
using Microsoft.EntityFrameworkCore;
using EFCoreLockStudy2;
Console.WriteLine("修改数据");
using var db = new SqlDbContext();
using var trans = db.Database.BeginTransaction();

var house =  await db.Houses.FromSqlInterpolated($" select * from T_house with(rowLock) where id = 1").SingleAsync() ;
house.Owner = "mmm";
db.SaveChanges();

trans.Commit();
Console.ReadKey();
